package com.cskaoyan.controller.backstagecontroller;

import com.cskaoyan.bean.data.*;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin")
public class UserController {

    @Autowired
    UserService userService;

    //会员管理模块
    @RequestMapping("user/list")
    public BaseRespVo userList(Integer page, Integer limit, String sort, String order, String username, String mobile) {
        UserData userData = userService.selectUserData(page, limit, sort, order, username, mobile);
        return BaseRespVo.ok(userData);
    }

    //收货地址模块
    @RequestMapping("address/list")
    public BaseRespVo addressList(Integer page, Integer limit, String sort, String order, Integer userId, String name) {
        AddressData addressData = userService.selectAddressData(page, limit, sort, order, userId, name);
        return BaseRespVo.ok(addressData);
    }

    //会员收藏
    @RequestMapping("collect/list")
    public BaseRespVo collectList(Integer page, Integer limit, String sort, String order, Integer id, Integer userId) {
        CollectData collectData = userService.selectCollectData(page, limit, sort, order, id, userId);
        return BaseRespVo.ok(collectData);
    }

    //会员足迹
    @RequestMapping("footprint/list")
    public BaseRespVo footprintList(Integer page, Integer limit, String sort, String order, Integer goodsId, Integer userId) {
        FootprintData footprintData = userService.selectFootprintData(page, limit, sort, order, goodsId, userId);
        return BaseRespVo.ok(footprintData);
    }

    //搜索历史
    @RequestMapping("history/list")
    public BaseRespVo historyList(Integer page, Integer limit, String sort, String order, Integer userId, String keyword) {
        SearchHistoryData searchHistoryData = userService.selectSearchHistoryData(page, limit, sort, order, userId, keyword);
        return BaseRespVo.ok(searchHistoryData);
    }

    //意见反馈
    @RequestMapping("feedback/list")
    public BaseRespVo feedbackList(Integer page, Integer limit, String sort, String order, Integer id, String username) {
        FeedBackData feedBackData = userService.selectFeedBackData(page, limit, sort, order, id, username);
        return BaseRespVo.ok(feedBackData);
    }

}
